import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import * as roleApi from '/@/api/sys/role';
const { t } = useI18n();

const searchForm: FormProps = {
  baseColProps: { lg: 12, md: 12 },
  wrapperCol: { lg: 24, md: 24 },
  showResetButton: false,
  showAdvancedButton: false,
  schemas: [
    {
      field: 'roleName',
      component: 'Input',
      componentProps: {
        placeholder: "主体名称",
        allowClear: true
      },
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('名称'),
    dataIndex: 'roleName',
    width: 100,
    align: 'left',
    // slot: 'firstColumn',
  },
  {
    title: t('描述'),
    align: 'left',
    dataIndex: 'remark',
    width: 120,
  }
];

const tableProps: BasicTableProps = {
  api: roleApi.pageRole,
  beforeFetch: (params) => {
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  showIndexColumn: false,
  rowKey: 'id',
} as BasicTableProps;

export default {
  tableProps,
  itemCode: 'id',
  itemName: 'roleName',
  itemDesc: 'remark',
  isShowCode: false,
};
